#include <natives.h>
#include <decls.hpp>
#include <exceptions.hpp>

#include <cubefs/api/metadata/metadata.hpp>

JNIEXPORT jint JNICALL MODELS_PKG(Page, size) (JNIEnv *env, jclass, jlong me)
{
    CUBEFS_EXC_BEGIN

    Page* page = Handle2Ptr<Page>(me);
    return page->Size();

    CUBEFS_EXC_HANDLE
    return 0;
}

JNIEXPORT jint JNICALL MODELS_PKG(Page, GetByte) (JNIEnv *env, jclass, jlong me, jint idx)
{
    CUBEFS_EXC_BEGIN

    Page* page = Handle2Ptr<Page>(me);
    return page->GetByte(idx);

    CUBEFS_EXC_HANDLE
    return 0;
}

JNIEXPORT void JNICALL MODELS_PKG(Page, SetByte) (JNIEnv *env, jclass, jlong me, jint idx, jint value)
{
    CUBEFS_EXC_BEGIN

    Page* page = Handle2Ptr<Page>(me);
    return page->SetByte(idx, value);

    CUBEFS_EXC_HANDLE
}